package edu.njust.Service.reservation.impl;

import edu.njust.Service.reservation.ReservationService;
import edu.njust.dao.ReservationMapper;
import edu.njust.domain.Reservation;
import edu.njust.domain.StayRegister;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReservationServiceImpl implements ReservationService {
    @Autowired
    private ReservationMapper reservationMapper;

    @Override
    public boolean insertAll(Reservation reservation) {
        return reservationMapper.insertAll(reservation)>0;
    }

    @Override
    public List<Reservation> pageFuzzyselect(String passengerName, int predetermineStateID, int start, int pageSize) {
        return reservationMapper.pageFuzzyselect(passengerName,predetermineStateID,start,pageSize);
    }

    @Override
    public int countFuzzyselect(String passengerName, int predetermineStateID) {
        return reservationMapper.countFuzzyselect(passengerName,predetermineStateID);
    }

    @Override
    public Reservation findById(int id) {
        return reservationMapper.findById(id);
    }

    @Override
    public List<Reservation> findLvKeId(int id) {
        return reservationMapper.findLvKeId(id);
    }

    @Override
    public boolean deleteById(int id) {
        return reservationMapper.deleteById(id)>0;
    }

    @Override
    public List<Reservation> selectAll() {
        return reservationMapper.selectAll();
    }

    @Override
    public boolean updateRemind(int id) {
        return reservationMapper.updateRemind(id)>0;
    }

    @Override
    public boolean updatePredetermineStateIDone(int id) {
        return reservationMapper.updatePredetermineStateIDone(id)>0;
    }

    @Override
    public boolean updatePredetermineStateIDtwo(int id) {
        return reservationMapper.updatePredetermineStateIDtwo(id)>0;
    }

    @Override
    public boolean updateroomID(int id, int roomID) {
        return reservationMapper.updateroomID(id,roomID)>0;
    }

    @Override
    public StayRegister findStayRegister(int id) {
        return reservationMapper.findStayRegister(id);
    }

}
